<template>
  <div>
    
    <MyCom 
    v-for="(item,idx) in list" :key="item.id"
    :proname="item.proname"
    :proprice="item.proprice"
    :info="item.info"
    @pdd="dao"
    :idx="idx"
    />
    
    
   
  </div>
</template>
<script>
// 导入=>注册=>使用
import MyCom from './MyCom.vue'
export default {
  data() {
    return {
      list: [
        {
          id: 1,
          proname: "超级好吃的棒棒糖",
          proprice: 18.8,
          info: "开业大酬宾, 全场8折",
        },
        {
          id: 2,
          proname: "超级好吃的大鸡腿",
          proprice: 34.2,
          info: "好吃不腻, 快来买啊",
        },
        {
          id: 3,
          proname: "超级无敌的冰激凌",
          proprice: 14.2,
          info: "炎热的夏天, 来个冰激凌了",
        },
      ],
    }
  },
  methods: {
    dao(obj){
      this.list[obj.idx].proprice -= obj.n
    }
  },
  components:{
    MyCom
  }
}
</script>